home *** CD-ROM | disk | FTP | other *** search
- ;This is a procedure callable from QBasic to save the current screen to a
- ;buffer passed as the address of a 2000 integer array.
-
- Name Savescrn ;Name used at link time
- Public Savescrn ;Only label that is public
-
- Savescrn: ORG 0 ;Since will be linked later
-
- jmp short Getpara ;Get parameters
-
- Vidmem equ 0B800h ;Video page 1 segment
- Scrnbuf: dw ? ;Screen buffer location from Basic
- Msg1: db 'Not in a color mode now.$' ;Error message
-
- Getpara: push bp
- mov bp,sp
- push es
- push ds
- push cs ;es=cs
- pop es
- cld
- mov bx,[bp+6] ;Get address of screen buffer location in ds
- mov ax,ds:[bx] ;Get location of screen buffer in ds
- mov cs:[Scrnbuf],ax
-
- ;Get current video mode and page
- mov ah,15 ;Get current video mode
- int 10h
- cmp al,2 ;Mode 2?
- je Color ;Yes
- cmp al,3 ;Mode 3?
- je Color ;Yes
- mov dx,Msg1 ;No, print message
- mov ah,9
- int 21h
- Exit: ;Return to Basic
- pop ds
- pop es
- pop bp
- retf 2
-
-
- Color: ;Find video memory.
- mov bl,0 ;bx=page offset
- add bx,Vidmem ;Add page 0 address
-
- ;Save current screen.
- push ds ;Set es for Basic ds
- pop es
- mov ds,bx ;Set ds for screen memory
- mov di,cs:[Scrnbuf] ;Point to buffer in Basic ds
- mov si,0 ;Start of screen
- mov cx,80*25 ;Words to move
- rep movsw ;Move them
- jmp Exit
-